gskrenderer.c: Default to the GL renderer on Windows too
authorChun-wei Fan <fanchunwei@src.gnome.org>
Fri, 31 Jul 2020 10:44:10 +0000 (18:44 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Fri, 31 Jul 2020 15:20:14 +0000 (23:20 +0800)
Since we have now made the Win32 GL contexts share the global context as
the other backends have, we are more ready to use the GL renderer by
default on Windows as well.

Note that currently we can only enable this when not running on
OpenGL/ES as the OpenGL/ES shaders are not ready at this point, and the
OpenGL/ES support that we have from libANGLE does not support full
desktop OpenGL operations.

gsk/gskrenderer.c

index 5f4b1deeb87acc47d59ee94a3384f985471bc92c..1ac74110f914c20a4f5f87d3aa5960c35b270340 100644 (file)
 #ifdef GDK_WINDOWING_MACOS
 #include <gdk/macos/gdkmacos.h>
 #endif
+#ifdef GDK_WINDOWING_WIN32
+#include <gdk/win32/gdkwin32.h>
+
+/* Remove these lines when OpenGL/ES 2.0 shader is ready */
+#include "win32/gdkprivate-win32.h"
+#include "win32/gdkdisplay-win32.h"
+#endif
 
 typedef struct
 {
@@ -562,6 +569,17 @@ get_renderer_for_backend (GdkSurface *surface)
   if (GDK_IS_MACOS_SURFACE (surface))
     return GSK_TYPE_GL_RENDERER;
 #endif
+#ifdef GDK_WINDOWING_WIN32
+  if (GDK_IS_WIN32_SURFACE (surface))
+    /* remove check for OpenGL/ES when OpenGL/ES 2.0 shader is ready */
+    {
+      GdkDisplay *display = gdk_surface_get_display (surface);
+
+      if (!(GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES) ||
+            GDK_WIN32_DISPLAY (display)->running_on_arm64))
+        return GSK_TYPE_GL_RENDERER;
+    }
+#endif
 
   return G_TYPE_INVALID;
 }